package cn.alpha.intell.rbtlib.rbt.utils;

import android.content.Context;

import cn.alpha.intell.rbtlib.manager.media.AudioMediaPlay;

/**
 * @author : jinlongfeng
 * @version : V2.1.2
 * @description: 按钮音效
 * @time : 2016/12/13-19:43
 */

public final class ButtonSound {

    /**
     * @deprecated 使用系统默认的触摸音效
     * @param context
     */
    @Deprecated
    public static void playOgg(Context context){
        // 直接使用系统的触摸音效
//        AudioAttributes audioAttributes = new AudioAttributes.Builder()
//                .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
//                .setLegacyStreamType(AudioManager.STREAM_MUSIC)
//                .setUsage(AudioAttributes.USAGE_GAME)
//                .build();
//
//        SoundPool soundPool = new SoundPool.Builder()
//                .setMaxStreams(1)
//                .setAudioAttributes(audioAttributes)
//                .build();
//        final  int soundPoolId = soundPool.load(context,R.raw.pop_click,1);
//
//        soundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
//            @Override
//            public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
//                soundPool.play(soundPoolId,1,1,0,0,1);
//            }
//        });


    }

    public static void playOgg(Context context,int resId){
        AudioMediaPlay audioMediaPlay = new AudioMediaPlay(context,resId);
        audioMediaPlay.startPlay();
    }
}
